<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .box1{
            width: 150px;
            height: 50px;
            border: 1px solid #ccc;
            margin: 20px auto;
            text-align: center;
            line-height: 50px;
            position: relative;
            cursor: pointer;

        }
        .box2{
            width: 80px;
            height: 30px;
            font-size: 12px;
            background-color: #f5f5f5;
            border-radius: 20px;
            line-height: 30px;
            text-align: center;
            position: absolute;
            top: 10px;
            right: -50px;
            visibility: hidden;
        }
        .box1:hover .box2{
            visibility: visible;

        }
    </style>
</head>
<body>
    <div class="box1">鼠标移动到此位置
        <div class="box2">提示文字</div>
    </div>
    
</body>
</html>